Repository navigation
W-886: Digit quick-pick for the typed-query list - #249
Open
Aryan-Techie wants to merge 2 commits into
Open
Aryan-Techie wants to merge 2 commits into
Aryan-Techie wants to merge 2 commits into
Conversation
While the shortcode list is up, 1–9 inserts that row, the way 1–8 already does on the Quick Access pill. The first nine rows show their digit at the trailing edge, and the footer shows a `1–9` keycap next to ↵ (the arrows lose their "select" label to make room in the 280 pt panel). A digit only picks when appending it would leave the query with no matches, so `:smil` + `2` picks the second row while `:clock1`, `:+1:` and `:100:` still type normally. The state machine asks the Engine through a search probe that runs only on a digit while the list is armed. The Engine arms the row count from the results it shows, and any query edit disarms it until the next refresh, so a digit never picks from a stale list. The trailing Browse row is never a target, and a sticky (Shift+Return) session keeps typing digits into its search. Refs: W-886
The collision probe runs inside `stateMachine.handle`, a mutating call on an Engine property, and it read `stateMachine.config` through `corpusFor`. That overlapping access fails Swift's runtime exclusivity check, so the first digit typed with the list armed (`:smil` + `1`) would trap. Engine now mirrors the trigger config it loads, and `corpusFor` reads that copy. Digits also stop at the rows the list draws without scrolling (`PickerLayout.maxVisibleRows`, 6), so a digit never inserts a row the user can't see; the footer reads `1–6`. Refs: W-886
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While the shortcode list is up (
:smil), pressing a digit inserts that row, the same way 1–8 already works on the Quick Access pill. Each pickable row shows its digit at the trailing edge, like a menu's key equivalents, and the footer reads↑↓↵1–6insert (1–Nwhen fewer rows match).Digits cover the rows the list draws without scrolling. That's 6 today (
PickerLayout.maxVisibleRows), not the 9 the issue suggests, so a digit never inserts a row you can't see. The state machine allows up to 9, so raisingmaxVisibleRowsextends it.The collision guard is the one proposed in the issue: a digit picks only when appending it would leave the query with no matches. So
:smil+2picks the second row, while:clock1(🕐),:100:(💯) and:+1:still type normally.0never picks. A sticky session (Shift+Return) keeps typing digits into its search, and the trailing "Browse all emojis…" row is never a target.KeyMonitor/TriggerStateMachine.swift: new.pickListIndex(_:query:scope:)action. A digit picks whenlistQuickPickCount(the rows the Engine says are on screen) covers it and the Engine-suppliedqueryHasMatchesprobe reports that the extended query matches nothing. Any query edit, sticky/browser entry, new capture orreset()disarms the count until the next refresh, so a digit never picks from a stale list. Mid-close (::star:) digits type through. The pill path (emptyPickerActive/.pickIndex) is untouched.App/Engine.swift: arms the count from the visible rows it puts in the list, and only during a live capture. The probe is aFuzzyMatcher.search(limit: 1)that runs only when a digit arrives while the list is armed..pickListIndexgoes through the sameinsert(.fromPicker)path as Return, so the erased span (:query,::query, or a custom open) matches Return exactly. A digit is never consumed without a row to insert. The probe runs insidestateMachine.handle, so it reads a mirrored copy of the trigger config instead ofstateMachine.config, which would be an overlapping access and trap Swift's runtime exclusivity check.Picker/PickerView.swift,PickerViewModel.swift,HintsFooter.swift: row badges and the footer hint.KeyHintgains a multi-key form so↵and1–9share the "insert" label. To fit the 280 pt panel, the arrows drop their "select" label while digits are live; sticky sessions keep the old footer. No new strings.Tests/MojitoTests/TriggerStateMachineTests.swift:ListQuickPickTests(13 tests). They cover picking, the collision guard (and what the probe receives),0, out-of-range digits, unarmed and probe-less states, disarm on edit,::scope delete length, sticky sessions, the unchanged pill pick, andreset().Offscreen renders of
PickerView(no panel glass):Test plan
MojitoTestssuite passes locally: 336 tests, built against the macOS 26.5 SDK with the Swift 6.4 command-line tools through a SwiftPM wrapper, because the machine I built this on has no Xcode. The one exception,DebugReportTests.forbiddenStringsNeverAppear, fails the same way onmainunder that wrapper, since the report sees the runner's non-bundle path.scripts/check_localizations.pyandscripts/check_telemetry.pypass.scripts/run-tests.sh/ CI on Xcode.:smilthen2inserts the second row and erases:smil;:clock1keeps typing;::starthen1inserts a symbol and erases::star; after Shift+Return, digits search in the sticky session;:?then3still picks from the pill.Fixes #204 · Refs W-886